package com.rd.student.jiaji.class3.wangyanbo.day0728;

import java.io.File;
import java.util.*;

public class Enumerator {

        public static void main(String[] args) {
            List<String> names = Arrays.asList("孙国伟", "秦家林", "王岩博", "张世煊", "才雨鑫", "徐铭泽", "孙可");

            Scanner scanner = new Scanner(System.in);
            System.out.println("请输入随机出的人数：");
            int n = scanner.nextInt();
            Random random = new Random();

            HashSet<String> p = new HashSet<>();
            while (p.size() < n) {
                int index = random.nextInt(names.size());
                p.add(names.get(index));
            }
            System.out.println("随机出的人员名单为：");
            for (String name : p) {
                System.out.print(name+" ");
            }
        }
    }

